package com.ky.pro.java.nio.http.server.filter.impl;

import com.ky.pro.java.nio.http.server.filter.IGatewayInboundFilter;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.FullHttpRequest;
import io.netty.handler.codec.http.HttpRequest;

/**
 * @ClassName GreetingsHeaderFilter
 * @Description 示例过滤器，在header中添加问候语
 * @Date 2021/11/20 16:32
 * @Author kevin
 **/
public class GreetingsHeaderFilter implements IGatewayInboundFilter {

    @Override
    public void filter(HttpRequest request, ChannelHandlerContext ctx) {
            if(request instanceof FullHttpRequest) {
                request.headers().add("greetings","hello");
            }
    }
}
